

function addSensorbitCod(Blockly) {




    //钢琴模块初始化
  Blockly.Python.microbit_pianoInit = function(block) {
    var dropdown_pianoCLK = this.getFieldValue('pianoCLK');
    var dropdown_pianoDIO = this.getFieldValue('pianoDIO');
    Blockly.Python.definitions_['import_microbit'] = 'from microbit import *';
    Blockly.Python.definitions_['import_TouchPiano'] = 'from input import touch_piano';
    Blockly.Python.definitions_['piano_init'] = 'touch_piano.init('+dropdown_pianoCLK+', '+dropdown_pianoDIO+')\n';
    return '';
  }

  //钢琴模块 获取钢琴值
  Blockly.Python.microbit_getPianoKey = function(block) {
    var code = 'key = touch_piano.get_key()\n' ;
    return code;
  }

  //钢琴模块
  Blockly.Python.microbit_piano = function(block) {
    var dropdown_piano2 = this.getFieldValue('piano2');
     Blockly.Python.definitions_['codeLine_pianoData'] = '  key = touch_piano.get_key()';
    var code = 'key == ' + dropdown_piano2;
    return [code];
  }

    return Blockly;
}

module.exports = addSensorbitCod;

